<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>


        <ui:composition template="./../../Template/generalTemplate.xhtml">

            <ui:define name="content">

                <h:form id="form3" prependId="false">
                    <f:view beforePhase="#{createInquiryResultManagedBean.initView}">
                        <p:panel id="inquiryR" header="Sales Inquiry View" style="height:495px;">
                            <div style="margin-left:50px;margin-right:50px;">
                                <div style="margin-bottom:20px;margin-top:20px;font-weight:bold;font-size:1.3em;">
                                    <h:outputText value="Company:" />  
                                    <h:outputText value="#{createInquiryResultManagedBean.inquiry.company.name}" />
                                    <br /><br />
                                    <h:outputText value="Raise Date: " />
                                    <h:outputText value="#{createInquiryResultManagedBean.inquiry.raiseDate}" >  
                                        <f:convertDateTime pattern="dd-MM-yyyy" />
                                    </h:outputText>
                                 
                                </div>

                                <p:dataTable var="lineItem" value="#{createInquiryResultManagedBean.lineItems}" dynamic="true" emptyMessage="No product selected">
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Proudct" />
                                        </f:facet>
                                        <h:outputText value="#{lineItem.product.productName}" />
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Quantity (in cases)" />
                                        </f:facet>
                                        <h:outputText value="#{lineItem.quantity}" />
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Original Unit Price" />
                                        </f:facet>
                                        <h:outputText value="#{lineItem.product.basePrice}" />
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Promotional Price" />
                                        </f:facet>
                                        <h:outputText value="#{lineItem.product.promotionPrice}" />
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Discount" />
                                        </f:facet>
                                        <h:outputText value="#{lineItem.discount}" />
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Unit Price after Discount" />
                                        </f:facet>
                                        <h:outputText value="#{lineItem.price}" />
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Subtotal" />
                                        </f:facet>
                                        <h:outputText value="#{lineItem.cumAmount}" />
                                    </p:column>

                                </p:dataTable>

                                <br />
                                <p:commandButton value="Edit"  ajax="false" actionListener="#{createInquiryResultManagedBean.editInquiry}" />
                                <p:commandButton value="Back"  ajax="false" actionListener="#{createInquiryResultManagedBean.goBack2}" />
                            </div>
                        </p:panel>
                    </f:view>
                </h:form>

            </ui:define>

            <ui:define name="bottom">
                <div id="msgbox" class="round">
                    <h:outputText value="#{createInquiryResultManagedBean.message}" />
                </div>
            </ui:define>

        </ui:composition>



    </body>
</html>
